<div id="sidebar">
    <h3>поиск</h3>
    <div>
        <form action="/">
            <input style="width: 234px" value="<?php echo isset($_GET['search']) ? (strip_tags(trim($_GET['search']))) : '' ?>" type="text" name="search" size="0" />
            <input style="cursor: pointer" type="submit" value="&raquo;&nbsp;go" class="formbutton" />
        </form>
    </div>
    <?php if (is_array($this->categories) && count($this->categories)) {
        ?>
        <h3 style="margin-bottom: 15px;">навигатор</h3>
        <div class="sidelinks">
            <?php
            foreach ($this->categories as $cat) {
                if (!empty($cat['left_menu'])) {
                    ?>
                    <div  class="menu-item"><a class="radius4 <?php echo (isset($this->cat) && $this->cat == $cat['url'] ) ? 'current' : ''; ?>" href="<?php echo (!empty($cat['url'])) ? '/' . $cat['url'] : 'javascript: void()' ?>"><?php echo $cat['title'] ?></a></div>
                    <div class="sub-menu-it">
                        <?php
                        if (is_array($this->pages) && count($this->pages)) {
                            foreach ($this->pages as $page) {
                                if ($page['category_id'] == $cat['id']) {
                                    ?>
                                    <p><a class="item<?php echo ($page['url'] == $this->page_url) ? ' item-current' : '' ?>" href="<?php echo strstr($page['url'], 'http://') ? $page['url'] : ( ($cat['url']) ? '/' . $cat['url'] . '/' . $page['url'] : '/' . $page['url']) ?>"><?php echo $page['title'] ?></a></p>
                                    <?php
                                }
                            }
                        }
                        if (isset($cat['child']) && count($cat['child'])) {
                            foreach ($cat['child'] as $child) {
                                ?>
                                <div class="child-menu"><div class="menu-item"><a class="radius4 <?php echo (isset($this->cat) && ($this->cat == $child['url']) || ($this->page_url == 'note' && $child['url'] == 'note' ) ) ? 'current' : ''; ?>" href="<?php echo (!empty($child['url'])) ? '/' . $child['url'] : 'javascript: void()' ?>"><?php echo $child['title'] ?></a></div>
                                    <?php
                                    if (is_array($this->pages) && count($this->pages)) {
                                        foreach ($this->pages as $page) {
                                            if ($page['category_id'] == $child['id']) {
                                                ?>
                                                <p><a class="item<?php echo ($page['url'] == $this->page_url) ? ' item-current' : '' ?>" href="<?php echo strstr($page['url'], 'http://') ? $page['url'] : ( ($cat['url']) ? '/' . $cat['url'] . '/' . $page['url'] : '/' . $page['url']) ?>"><?php echo $page['title'] ?></a></p>
                                                <?php
                                            }
                                        }
                                    }
                                    if ($child['url'] == 'note') {
                                                ?>
                                                <div>
                                                    <?php foreach ($this->useful as $aUseful) { ?>
                                                        <p><a class="item" href="/note#<?php echo $aUseful['title'] ?>"><?php echo $aUseful['title'] ?></a></p>
                                                    <?php } ?>
                                                </div>
                                                <?php
                                            } 
                                    echo '</div>';
                                }
                            }
                            echo '</div>';
                        }
                    }
                    ?>
                </div>
            <?php } ?>
            <h3>афоризм/мудрость</h3>
            <p style="text-indent: 20px;"><?php echo $this->afor['text'] ?></p>
            <div class="autor"><?php echo $this->afor['autor'] ?></div>
            <br />
            <hr /><br />
            <?php _calendar(); ?>
            <br />
            <hr /><br />
            <?php if (is_array($this->qs) && count($this->qs)) {
                ?>

                <h3>search requests</h3>
                <p style="text-indent: 20px; margin-top: 10px;">
                    <?php
                    $i = 0;
                    foreach ($this->qs as $qs) {
                        if (!empty($qs)) {
                            ?>
                            <span class="<?php echo ($i % 2) ? 'normalFont' : 'bigFont' ?>"><?php echo strip_tags($qs) ?></span>
                            <?php
                            ++$i;
                        }
                    }
                }
                ?>
            </p>
        </div>
        <br/>